<include file="Public:header" />
<div style="line-height:32px">
<div>
<img src="{$Think.config.IMG_PATH}<if condition='$data.state eq 2'>{$data.img}<else/>/App/Vote/Static/img/404.jpg</if>" class="img" width="100" height="100">

</div>
<div>No:{$data.id} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$data.name}</div>
<div id="votenum">{$data.vote_num}</div>
<div >{$data.info}</div>
<div class="back">
  <button type="button" class="btn btn-default"  onclick="addvote()"> <span class="glyphicon glyphicon-step-backward" aria-hidden="true"></span> 投票 </button>
</div>
<div class="back">
  <button type="button" class="btn btn-default" onclick="history.go(-1)"> <span class="glyphicon glyphicon-step-backward" aria-hidden="true"></span> 返回 </button>
</div>
</div>
<h3>奖品设置</h3>
<p class="rules">{$info.lottery}</p>
<h3>活动规则</h3>
<p class="rules">{$info.rules}</p>
<include file="Public:footer" /> 
<script type="text/javascript">
var activityid = "{$_GET['activity_id']}";
var userid = "{$_GET['id']}";
function addvote(){
alert(1);return;
	$.getJSON('__URL__/subVote', {activityid:activityid,userid:userid}, function(json){
	
		if(json.status == 10){
			var html='';
			html+='<div class="code-fixed"><div class="code"><img src="__ROOT__/App/Vote/Static/images/close.png" class="close" onclick="$(this).parent().parent().hide()"><input type="text" id="verify" name="verify" maxlength="11" > <img src="__APP__/Index/verify/" onClick="fleshVerify()" border="0" alt="点击刷新验证码" title="点击刷新验证码" align="absmiddle" id="verifyImg" /><br/><button class="code_submit" onclick=subvote('+activityid+','+userid+')>提交</button></div></div>';
			$("body").append(html);
			return;
		}
		else{
		alert(11);
			Util.showmsg(json.info);
		}
				
	})
}

	
	

function subvote(activityid,userid){
	var verify = $("#verify").val();
	if(verify ==""){
	Util.showmsg("请输入验证码!");
	}else{
		$.getJSON('__URL__/subVote', {activityid:activityid,userid:userid,verify:verify}, function(json){
			
			if(json.status ==1){
				$(".code-fixed").addClass("hide")
				$("#votenum").html(json.data);
			}else{
				Util.showmsg(json.info);
			}
		})
	}

}

function fleshVerify() {

    var timenow = new Date().getTime();
    $('#verifyImg').attr("src", '__URL__/verify/' + timenow);
}

</script>